<% include ../head %>
<div class="container">


    <!-- Main Content Row -->
    <div class="main row">
        <div class="span8">
            <div id="learn" class="hero-unit path">
                <h2><a><i class="icon icon-cogs"></i> Neo4j on Amazon EC2</a></h2>

                <p class="lead">For ultimate control, you can provision Neo4j to perfectly match your needs</p>
            </div>
            
            <h2  id="video">Manual Setup Neo4j on EC2</h2>
            
            <a data-toggle="lightbox" href="#ec2video" class="thumbnail"><img src="<%=asset('img/still/ec2_install.gif')%>"
                                                                                  alt="Click to View"/></a>

            <p class="caption"><i class="icon icon-facetime-video"></i> Peter Neubauer shows how to install Neo4j on EC2.
            </p>

            <div class="lightbox fade" id="ec2video" tabindex="-1" style="display: none;" src="http://player.vimeo.com/video/58019458">
                    <div class='lightbox-content'>
                        <iframe src="" width="1000" height="432" frameborder="0"
                            webkitallowfullscreen="webkitAllowFullScreen" mozallowfullscreen="mozallowfullscreen"
                            allowfullscreen="allowFullScreen"></iframe>
                </div>
            </div>
            
            <h2 id="awstools">Install Amazon Tools</h2>

            <p>Follow Amazon&#39;s own <a
                    href="http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/Welcome.html">Getting
                Started guide</a>.</p>

            <h2 id="puppet">Setup <strong>only</strong> Neo4j using Puppet <a href="https://github.com/neo4j-contrib/neo4j-puppet/blob/master/README.md" target="_blank">(source)</a></h2>
            
            <blockquote class="external markdown">
                <%-: content.puppet | md %>
            </blockquote>

            <h2  id="manual">Launch an instance to host Neo4j</h2>

            <ol>
                <li>Log in to aws.amazon.com</li>
                <li>Go to the EC2 Console</li>
                <li>Click "Launch Instance"</li>
                <li>Select the "Classic Wizard"</li>
                <li>"Choose an AMI"

                    <ol>
                        <li>Select "Ubuntu Server 12.04.1 LTS" 64-bit</li>
                    </ol>
                </li>
                <li>"Instance Details"

                    <ol>
                        <li>Instance Type: "m1.large"</li>
                        <li>Availability Zone: "no preference"

                            <ul>
                                <li>just make sure it is any "us-east"</li>
                            </ul>
                        </li>
                        <li>Click "Continue"</li>
                    </ol>
                </li>
                <li>Instance Details - Advanced Instance Options

                    <ol>
                        <li>Termination Protection: enable</li>
                        <li>Click "Continue"</li>
                    </ol>
                </li>
                <li>Instance Details - Storage Device Configuration

                    <ol>
                        <li>Click "Edit"</li>
                        <li>Select "EBS Volumes"</li>
                        <li>Volume Size: 40GiB</li>
                        <li>Volume Type: Standard</li>
                        <li>Delete on Termination: disable (!!!)</li>
                        <li>Click "Add"
                            (Note the device path, something like /dev/sdf)
                        </li>
                        <li>Click "Continue"</li>
                    </ol>
                </li>
                <li>Instance Details - Add tags

                    <ol>
                        <li>Optional, and safe to ignore</li>
                        <li>Click "Continue"</li>
                    </ol>
                </li>
                <li>Create Key Pair

                    <ol>
                        <li>Choose an existing, or create a new Key Pair</li>
                        <li>be sure to <strong>adjust permissions</strong> of a created PEM file to only be
                            readable by you (e.g. <code>chmod go-rwx keypair.pem</code>)
                        </li>
                        <li>Select "Continue"</li>
                    </ol>
                </li>
                <li id="firewall">Configure Firewall
                    <ol>
                        <li>Select "Create a new Security Group"</li>
                        <li>Group Name "Neo4j"</li>
                        <li>Group Description "for remote access to Neo4j database"</li>
                        <li>Port range: 7474</li>
                        <li>(check out Heroku instructions <a
                                href="https://devcenter.heroku.com/articles/external-services">here</a>)
                        <li>or programmatically <code>$ ec2-authorize Neo4j -P tcp -p 7474 -u 098166147350 -o
                            default</code>
                        </li>
                        <li>Click "Continue"</li>
                    </ol>
                </li>
                <li>Review &amp; Launch
                    <ol>
                        <li>Review the settings</li>
                        <li>Click "Launch"</li>
                    </ol>
                </li>
            </ol>


            <p>Wait for the instance to launch by monitoring it on the "Instances" dashboard.
                Once it is running ssh onto the instance like so:
                <code>ssh -i /path/to/keypair.pem ubuntu@ec2-???-??-???-???.compute-1.amazonaws.com</code></p>

            <h2 id="debian">Add Neo4j on Debian/Ubuntu</h2>

            <% include ../download/debian %>

            <h3>Confirm Neo4j is running locally</h3>

            <p><code>curl http://localhost:7474</code></p>

            <h3 id="config">Make Neo4j accessible from the outside</h3>

            <p>Only do this if it is necessary, for instance when your services accessing Neo4j run on a different host.
                Make sure to secure the instance by
                enabling SSL and adding authentication (like the <a
                        href="http://github.com/neo4j-contrib/authentication-extension"
                        target="_blank">authentication-extension</a>.
            </p>
            <ol>
                <li>Find and open: <code>/path/to/neo4j/conf/neo4j-server.properties</code></li>
                <li>uncomment the line: <code>#org.neo4j.server.webserver.address=0.0.0.0</code></li>
                <li>Check that SSL access is enabled: <code>org.neo4j.server.webserver.https.enabled=true</code></li>
                <li>restart the Neo4j Server: <code>sudo /etc/init.d/neo4j-server restart</code></li>
                <li>Check if it is accessible from the outside: <code>curl
                    http://ec2-???-??-???-???.compute-1.amazonaws.com:7474</code>
                </li>
            </ol>


        </div>

        <aside class="span4 sidebar">
            <div class="summary">
                <h2>Briefly</h2>

                <div class="well">
                    <li><a href="#ec2video">Video</a> installation instructions</li>
                    <li>Neo4j runs on <a href="#manual">EC2 Ubuntu AMI's</a></li>
                    <li>Configure <a href="#firewall">Firewall</a></li>
                    <li>Install Neo4j via <a href="#debian">debian</a>, <a href="/install">download</a>, <a href="#puppet">puppet</a></li>
                    <li>Configure external Access</li>
                </div>
            </div>

            <div class="next-steps">
                <h2>Next Steps</h2>

                <div class="next thumbnail">
                    <div class="caption">
                        <p>DIY in the Cloud</p>
                        <ol>
                            <li>
                                <a href="http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/Welcome.html"  target="_blank">Getting
                                    Started Guide on Amazon EC2</a></li>
                            <li>Provision a generous EC2 Instance</li>
                            <li><a href="/install">Install Neo4j</a> on the EC2 instance</li>
                            <li>Mix in the <a href="http://github.com/neo4j-contrib/authentication-extension" target="_blank">authentication
                                plugin</a></li>
                            <li>Read how to <a href="http://blogs.mindspew-age.com/2012/12/04/another-great-example-of-aws-fidelity-neo4j-cloud-init-and-eucalyptus/" target="_blank">deploy Neo4j on Eucalyptus</a></li>
                        </ol>
                    </div>
                </div>
            </div>

        </aside>
    </div>

</div>
<% include ../foot %>

